import flask
from service.user import user
from utils.token import require_token


app = flask.Flask(__name__)


@app.route('/user/login', methods=['GET'])
def login():
    username = flask.request.args.get('username')
    password = flask.request.args.get('password')
    return user.login(username=username, password=password)


@app.route('/user/info', methods=['GET'])
@require_token
def info():
    username = flask.request.headers.get('username')
    return user.info(username=username)



if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)